29. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2024-03-04 14:38:23 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

29.1 Files compared

#LocationFileLast Modified
1/Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme v4.0.7/app/code/Smartwave/Porto/BlockCategoryCollection.php2018-07-18 19:42:46 +0000
2/Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme v4.0.8/app/code/Smartwave/Porto/BlockCategoryCollection.php2024-01-30 14:21:21 +0000

29.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged11236
Changed612
Inserted48
Removed00

29.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

29.4 Active regular expressions

No regular expressions were active.

29.5 Comparison detail

1 <?php 1 <?php
2 namespace Smartwave\Porto\Block; 2 namespace Smartwave\Porto\Block;
3  3 
4 class CategoryCollection extends \Magento\Framework\View\Element\Template 4 class CategoryCollection extends \Magento\Framework\View\Element\Template
5 { 5 {
6  6 
7      protected $_categoryHelper; 7      protected $_categoryHelper;
8      protected $categoryFlatConfig; 8      protected $categoryFlatConfig;
9      protected $topMenu; 9      protected $topMenu;
10     /** 10     /**
11      * @param \Magento\Framework\View\Element\Template\Context $context 11      * @param \Magento\Framework\View\Element\Template\Context $context
12      * @param \Magento\Catalog\Helper\Category $categoryHelper 12      * @param \Magento\Catalog\Helper\Category $categoryHelper
13      * @param array $data 13      * @param array $data
14      */ 14      */
15     public function __construct( 15     public function __construct(
16         \Magento\Framework\View\Element\Template\Context $context, 16         \Magento\Framework\View\Element\Template\Context $context,
17         \Magento\Catalog\Helper\Category $categoryHelper, 17         \Magento\Catalog\Helper\Category $categoryHelper,
18         \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, 18         \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState,
19         \Magento\Theme\Block\Html\Topmenu $topMenu 19         \Magento\Theme\Block\Html\Topmenu $topMenu
20     ) { 20     ) {
21  21 
22         $this->_categoryHelper = $categoryHelper; 22         $this->_categoryHelper = $categoryHelper;
23         $this->categoryFlatConfig = $categoryFlatState; 23         $this->categoryFlatConfig = $categoryFlatState;
24         $this->topMenu = $topMenu; 24         $this->topMenu = $topMenu;
25         parent::__construct($context); 25         parent::__construct($context);
26     } 26     }
27     /** 27     /**
28      * Return categories helper 28      * Return categories helper
29      */    29      */
30     public function getCategoryHelper() 30     public function getCategoryHelper()
31     { 31     {
32         return $this->_categoryHelper; 32         return $this->_categoryHelper;
33     } 33     }
34  34 
35     /** 35     /**
36      * Return categories helper 36      * Return categories helper
37      * getHtml($outermostClass = '', $childrenWrapClass = '', $limit = 0) 37      * getHtml($outermostClass = '', $childrenWrapClass = '', $limit = 0)
38      * example getHtml('level-top', 'submenu', 0) 38      * example getHtml('level-top', 'submenu', 0)
39      */    39      */
40     public function getHtml() 40     public function getHtml()
41     { 41     {
42         return $this->topMenu->getHtml(); 42         return $this->topMenu->getHtml();
43     } 43     }
44     /** 44     /**
45      * Retrieve current store categories 45      * Retrieve current store categories
46      * 46      *
47      * @param bool|string $sorted 47      * @param bool|string $sorted
48      * @param bool $asCollection 48      * @param bool $asCollection
49      * @param bool $toLoad 49      * @param bool $toLoad
50      * @return \Magento\Framework\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection|array 50      * @return \Magento\Framework\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection|array
51      */     51      */
52    public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true) 52    public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true)
53     { 53     {
54         return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); 54         return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad);
55     } 55     }
56     /** 56     /**
57      * Retrieve child store categories 57      * Retrieve child store categories
58      * 58      *
59      */  59      */
60     public function getChildCategories($category) 60     public function getChildCategories($category)
61     { 61     {
62         if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) { 62         if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) {
63             $subcategories = (array)$category->getChildrenNodes(); 63             $subcategories = (array)$category->getChildrenNodes();
64         } else { 64         } else {
65             $subcategories = $category->getChildren(); 65             $subcategories = $category->getChildren();
66         } 66         }
67         return $subcategories; 67         return $subcategories;
68     } 68     }
69      69 
70     public function getChildCategoryHtml($category, $icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") { 70     public function getChildCategoryHtml($category, $icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") {
71         $html = ''; 71         $html = '';
72         if($childrenCategories = $this->getChildCategories($category)) { 72         if($childrenCategories = $this->getChildCategories($category)) {
73             $html .= '<ul>'; 73             $html .= '<ul>';
74             $i = 0; 74             $i = 0;
75             foreach($childrenCategories as $childrenCategory) { 75             foreach($childrenCategories as $childrenCategory) {
76                 if (!$childrenCategory->getIsActive()) { 76                 if (!$childrenCategory->getIsActive()) {
77                     continue; 77                     continue;
78                 } 78                 }
79                 $i++; 79                 $i++;
    80                 if($childrenCategories = $this->getChildCategories($category)) {
    81                   $html .= '<li class="parent"><a href="'.$this->_categoryHelper->getCategoryUrl($childrenCategory).'">'.$childrenCategory->getName().'</a>';
    82                 }else{
80                 $html .= '<li><a href="'.$this->_categoryHelper->getCategoryUrl($childrenCategory).'">'.$childrenCategory->getName().'</a>'; 83                   $html .= '<li><a href="'.$this->_categoryHelper->getCategoryUrl($childrenCategory).'">'.$childrenCategory->getName().'</a>';
    84                 }
81                 $html .= $this->getChildCategoryHtml($childrenCategory, $icon_open_class, $icon_close_class); 85                 $html .= $this->getChildCategoryHtml($childrenCategory, $icon_open_class, $icon_close_class);
82                 $html .= '</li>'; 86                 $html .= '</li>';
83             } 87             }
84             $html .= '</ul>'; 88             $html .= '</ul>';
85             if($i > 0) 89             if($i > 0)
86                 $html .= '<a href="javascript:void(0)" class="expand-icon"><em class="'.$icon_open_class.'"></em></a>'; 90                 $html .= '<a href="javascript:void(0)" class="expand-icon"><em class="'.$icon_open_class.'"></em></a>';
87         } 91         }
88         return $html; 92         return $html;
89     } 93     }
90      94 
91     public function getCategorySidebarHtml($icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") { 95     public function getCategorySidebarHtml($icon_open_class="porto-icon-plus-squared", $icon_close_class="porto-icon-minus-squared") {
92         $html = ''; 96         $html = '';
93         $categories = $this->getStoreCategories(true,false,true); 97         $categories = $this->getStoreCategories(true,false,true);
94         $html .= '<ul class="category-sidebar">'; 98         $html .= '<ul class="category-sidebar">';
95         foreach($categories as $category) { 99         foreach($categories as $category) {
96             if (!$category->getIsActive()) { 100             if (!$category->getIsActive()) {
97             continue; 101             continue;
98             } 102             }
    103             if($childrenCategories = $this->getChildCategories($category)) {
    104               $html .= '<li class="parent">';
    105             }else{
99             $html .= '<li>'; 106               $html .= '<li>';
    107             }
100             $html .= '<a href="'.$this->_categoryHelper->getCategoryUrl($category).'">'.$category->getName().'</a>'; 108             $html .= '<a href="'.$this->_categoryHelper->getCategoryUrl($category).'">'.$category->getName().'</a>';
101             $html .= $this->getChildCategoryHtml($category, $icon_open_class, $icon_close_class); 109             $html .= $this->getChildCategoryHtml($category, $icon_open_class, $icon_close_class);
102             $html .= '</li>'; 110             $html .= '</li>';
103         } 111         }
104         $html .= '</ul>'; 112         $html .= '</ul>';
105         $html .= '<script type="text/javascript"> 113         $html .= '<script type="text/javascript">
106             require([ 114             require([
107                 \'jquery\' 115                 \'jquery\'
108               ], function ($) { 116               ], function ($) {
109                 $(".category-sidebar li > .expand-icon").click(function(){ 117                 $(".category-sidebar li > .expand-icon").click(function(){
110                     if($(this).parent().hasClass("opened")){ 118                     if($(this).parent().hasClass("opened")){
111                         $(this).parent().children("ul").slideUp(); 119                         $(this).parent().children("ul").slideUp();
112                         $(this).parent().removeClass("opened"); 120                         $(this).parent().removeClass("opened");
113                         $(this).children(".'.$icon_close_class.'").removeClass("'.$icon_close_class.'").addClass("'.$icon_open_class.'"); 121                         $(this).children(".'.$icon_close_class.'").removeClass("'.$icon_close_class.'").addClass("'.$icon_open_class.'");
114                     } else { 122                     } else {
115                         $(this).parent().children("ul").slideDown(); 123                         $(this).parent().children("ul").slideDown();
116                         $(this).parent().addClass("opened"); 124                         $(this).parent().addClass("opened");
117                         $(this).children(".'.$icon_open_class.'").removeClass("'.$icon_open_class.'").addClass("'.$icon_close_class.'"); 125                         $(this).children(".'.$icon_open_class.'").removeClass("'.$icon_open_class.'").addClass("'.$icon_close_class.'");
118                     } 126                     }
119                 }); 127                 });
120             }); 128             });
121         </script>'; 129         </script>';
122         return $html; 130         return $html;
123     } 131     }
124 } 132 }